<template>
  <div >
    <MyHeader :title="title" :color="color" :bgc="backgroundColor"></MyHeader>
    <div class="main">
      <MyGoods v-for="obj in goodList" :key="obj.id"
      :obj="obj"
      ></MyGoods>
    </div>
    
    <MyFooter :list="goodList"></MyFooter>
  </div>
</template>

<script>
import MyHeader from './components/MyHeader.vue'
import MyFooter from './components/MyFooter.vue'
import MyGoods from './components/MyGoods.vue'
export default {
  data () {
    return {
      title:'我的购物车',
      color:'#000',
      backgroundColor:'#69A794',
      goodList:[]
    }
  },
  components:{
    MyHeader,
    MyFooter,
    MyGoods
  },
  //请求数据
   created(){
     this.$axios({
       url: '/api/cart'
     }).then(res =>{
      console.log(res)
      this.goodList = res.data.list
     }).catch(err =>{
      console.log(err)
     })
   }
}
</script>

<style scoped>
  .main{
    padding-top: 45px;
    padding-bottom: 50px;
  }
</style>